/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.sorbonne.soa.ws;

import fr.sorbonne.soa.entity.*;
import fr.sorbonne.soa.exception.OrderNotFoundException;
import javax.jws.WebService;
import javax.ejb.Stateless;

import fr.sorbonne.soa.lib.*;
import java.util.Date;
import javax.ejb.EJB;
import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;

/**
 *
 * @author Nairo
 */
@WebService()
@Stateless()
public class DistributorManufacturerWS {
    @EJB
    private ManagerDistributorLocal managerDistributorBean;

    /**
     * Web service operation
     */
    @WebMethod(operationName = "sendManufacturerInvoice")
    public void sendManufacturerInvoice(@WebParam(name = "invoice")
    InvoiceToDistributor invoice, @WebParam(name = "estimatedProductionStartDate")
    Date estimatedProductionStartDate)  {
        managerDistributorBean.createManufacturerInvoice(invoice, estimatedProductionStartDate);
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "sendProductionDate")
    public void sendProductionDate(@WebParam(name = "orderId")
    String orderId, @WebParam(name = "startingProductionDate")
    Date startingProductionDate) {
        managerDistributorBean.setProductionDate(orderId, startingProductionDate);
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "sendInvoiceDelayPenalty")
    public void sendInvoiceDelayPenalty(@WebParam(name = "invoice")
    InvoiceDelayToDistributor invoice) {
        managerDistributorBean.createInvoiceDelayPenalty(invoice);
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "receivePayment")
    public void receivePayment(@WebParam(name = "invoice")
    InvoiceToDistributor invoice) {
        managerDistributorBean.receivePayment(invoice);
    }

}
